package com.composite.demo1.main;

import com.composite.demo1.Waitress;
import com.composite.demo1.abs.MenuComponent;
import com.composite.demo1.impl.Menu;
import com.composite.demo1.impl.MenuItem;

/**
 * 组合模式：允许你将对象组成树形结构来表现“整体/部分”的层次结构。组合能让客户以一致的方式处理个别对象和对象组合
 * 
 * @author dell
 * 
 */
public class MenuTestDrive {

	public static void main(String args[]) {
		MenuComponent firstMenu = new Menu("早点菜单", "早点菜单");
		MenuComponent dinerMenu = new Menu("中午菜单", "中午菜单");
		MenuComponent cakeMenu = new Menu("午后餐点", "午后餐点");
		MenuComponent nightMenu = new Menu("晚餐菜单", "晚餐菜单");
		MenuComponent lastMenu = new Menu("宵夜菜单", "宵夜菜单");

		MenuComponent allMenus = new Menu("主菜单", "所有菜品");

		allMenus.add(firstMenu);
		firstMenu.add(new MenuItem("鸡蛋汤", "鸡蛋, 水", true, 2.99));
		firstMenu.add(new MenuItem("油条", "面, 油", false, 2.99));
		firstMenu.add(new MenuItem("热狗", "面包, 香肠", true, 3.49));

		allMenus.add(dinerMenu);
		dinerMenu.add(new MenuItem("宫保鸡丁", "鸡肉, 油, 黄瓜, 土豆", true, 2.99));
		dinerMenu.add(new MenuItem("鱼香肉丝", "肉, 土豆, 木耳", false, 2.99));
		dinerMenu.add(new MenuItem("水煮鱼", "鱼片, 生菜", false, 3.29));
		dinerMenu.add(new MenuItem("麻辣锅", "香肠, 豆腐, 生菜, 白菜", false, 3.05));

		dinerMenu.add(cakeMenu);
		cakeMenu.add(new MenuItem("苹果派", "苹果派", true, 1.59));
		cakeMenu.add(new MenuItem("奶茶", "奶茶", true, 1.99));
		cakeMenu.add(new MenuItem("咖啡", "咖啡", true, 1.89));

		allMenus.add(nightMenu);
		nightMenu.add(new MenuItem("黄瓜炒鸡蛋", "黄瓜, 鸡蛋", true, 3.99));
		nightMenu.add(new MenuItem("四喜丸子", "肉", false, 3.69));
		nightMenu.add(new MenuItem("炒米饭", "米饭, 鸡蛋", true, 4.29));

		nightMenu.add(lastMenu);
		lastMenu.add(new MenuItem("柠檬茶", "柠檬, 水", true, 1.59));
		lastMenu.add(new MenuItem("苹果", "苹果", false, 0.69));
		lastMenu.add(new MenuItem("蛋糕", "奶油蛋糕", true, 0.89));

		Waitress waitress = new Waitress(allMenus);
		waitress.printMenu();
	}

}
